package command.accept;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.Socket;

public class CommandAccept {
	private Socket socket;
	public OutputStream out;
	public BufferedReader reader;
	
	public CommandAccept(Socket socket){
		this.socket=socket;
	}
	public String commandRead() throws Exception{
		out=socket.getOutputStream();
		out.write("Please input command...".getBytes());
		InputStream in=socket.getInputStream();
		reader=new BufferedReader(new InputStreamReader(in));
		String s = reader.readLine();
		return s;	
	} 
	
	public String[] commandAnalyser() throws Exception{   //将输入命令解析为一个数组
		return commandRead().split("\\s+");
		
	}
}
